package com.outdd.vaietool.common.utils.convert;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * @program: EncodingConvert
 * @description:
 * @author: VAIE
 * @create: 2021-05-18 17:36
 **/
@Slf4j
public class EncodingConvert {

    /**
     * 中文转url参数
     * @param value
     * @return
     */
     public static String zhConvertUrl(String value){
         String url = "";
         try {
             if (StringUtils.isNotEmpty(value)) {
                 url= URLEncoder.encode(value, "utf-8");
             }
         } catch (UnsupportedEncodingException e) {
             log.error("zhConvertUrl",e);
         }
         return url;
     }

}
